<template>
    <div>
        <h1>home主页</h1>
    </div>
</template>

<script setup>
import { useRouter,useRoute } from 'vue-router';
import { onBeforeRouteLeave } from 'vue-router'

const router = useRouter()

// const route = useRoute()

// console.log(route.path);
// console.log(router.getRoutes());

onBeforeRouteLeave((to, from) => {
    console.log(to);
    if (to.path == '/home/comp1') {
        console.log(1);
        return true
    } else {
        return true
    }

})
</script>
<style lang="scss" scoped></style>